package com.czy.ekp.module;


import com.czy.ekp.gen.ModuleVo;
import com.czy.ekp.util.ResultMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/module")
public class ModuleController {

    @Autowired
    ModuleService moduleService;

    @RequestMapping("/generate")
    public void generateModule(@RequestBody ModuleVo moduleVo, HttpServletResponse response){
        moduleService.generateModule(moduleVo, response);
    }

    @RequestMapping("/deploy")
    @ResponseBody
    public ResultMap deployModule(MultipartFile file){
        return moduleService.deployModule(file);
    }

    @RequestMapping("/generateAndDeploy")
    @ResponseBody
    public ResultMap generateAndDeploy(@RequestBody ModuleVo moduleVo){
        return moduleService.generateAndDeploy(moduleVo);
    }

}
